package com.xiaoxin.nmzp.server.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaoxin.nmzp.server.entity.domain.NmzpJob;
import com.xiaoxin.nmzp.server.entity.domain.NmzpResume;
import com.xiaoxin.nmzp.server.entity.req.JobReq;
import com.xiaoxin.nmzp.server.entity.vo.JobRecord;
import com.xiaoxin.nmzp.server.entity.vo.NmzpJobVO;
import com.xiaoxin.nmzp.server.mapper.NmzpJobMapper;
import com.xiaoxin.nmzp.server.mapper.NmzpResumeMapper;
import com.xiaoxin.nmzp.server.service.NmzpJobService;
import com.xiaoxin.nmzp.utils.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author xiaoxin
* @description 针对表【nmzp_job】的数据库操作Service实现
* @createDate 2024-11-01 18:56:07
*/
@Service("jobService")
public class NmzpJobServiceImpl extends ServiceImpl<NmzpJobMapper, NmzpJob>
    implements NmzpJobService {
    @Autowired
    private NmzpResumeMapper resumeMapper;

    /**
     * 查询所有职位列表
     */
    @Override
    public List<NmzpJobVO> getJobList(JobReq jobReq) {
        return baseMapper.selectNmzpJobList(jobReq);
    }

    /**
     * 投递记录
     *
     * @return
     */
    @Override
    public List<JobRecord> getDeliveryJobList() {
        Long userId = UserUtils.get().getUserId();
        LambdaQueryWrapper<NmzpResume> nmzpResumeLambdaQueryWrapper = new LambdaQueryWrapper<>();
        nmzpResumeLambdaQueryWrapper.eq(NmzpResume::getUserId, userId);
        NmzpResume nmzpResume = resumeMapper.selectOne(nmzpResumeLambdaQueryWrapper);
        return baseMapper.getDeliveryJobList(nmzpResume.getResumeId());
    }
}




